|
|
|
|
|
|
|
Figure 12.5.
Displaying the new BoundColumn
and BoundText properties. |
|
|
|
|
| |
|
|
|
|
You can also activate the Get List event by entering cmdGetList_Click in the Dbl_Click event of DBList. The user can get the same results by selecting the command button, or by double-clicking the item in the list. This type of call provides a quick way of adding functionality to your code. You don't need to enter or maintain the code in both events. |
|
|
|
|
|
|
|
|
|
|
The data that is produced by the BoundText property can be used to update another column in a separate table. The easiest way to do this is to add a second data control and link the data-bound list control to that second data control. You can do this by setting the following two properties of the data-bound list control. |
|
|
|
|
|
|
|
|
· DataSource: The data set that is updated by the output of the data-bound list control. This is the data control used to open the destination Recordset. |
|
|
|
|
|
|
|
|
· DataField: The name of the column in the Recordset referred to by the DataSource property. |
|
|
|
|
|
|
|
|
Now let's add a second data control to the form and a bound input control that is updated by the data-bound list. First, add a data control. Set its DatabaseName property to C:\TYSDBVB5\SOURCE\DATA\LSTCNTRL.MDB and its RecordSource property to Destination. Also, set the EOFAction property of the Data2 data control to AddNew. Now add a text control to the project. Set its DataSource property to Data2 and its DataField property to NameID. Use Figure 12.6 as a layout guide. |
|
|
|
|
|
|
|
|
Before you save and run the project, set the DataSource and DataField properties of the data-bound list control. Set these to Data2 and NameID, respectively. This tells the list control to automatically update the Destination.NameID field. Now, each time a user selects an item in the list and then saves the data set of the second control, the designated field of the second data set is automatically updated with the value in the BoundColumnproperty of the data-bound list. |
|
|
|
|
|